package TestDemo;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

/**
 * Created with IntelliJ IDEA.
 * User: happyiu
 * Date: 2022-02-16
 * Time: 21:18
 * Description:
 */
public class Test {
    public static void main1(String[] args) {
        Collection collation = new ArrayList();
        collation.add("abcd");
        collation.add(12345);
    }

    public static void main2(String[] args) {
        Collection<String> collection = new ArrayList<>();
        collection.add("hello world!");
        collection.add("hhahah");

        //Collection<int> collection = new ArrayList<>();
        Collection<Integer> collection1 = new ArrayList<>();
        collection1.add(1);
        collection1.add(23456);

        System.out.println(collection);
        System.out.println(collection1);

    }

    public static void main3(String[] args) {
        Collection<String> collection = new ArrayList<>();
        collection.add("hello world!");
        collection.add("hhahah");

        Collection<Integer> collection1 = new ArrayList<>();
        collection1.add(1);
        collection1.add(23456);

        System.out.println(collection);
        System.out.println(collection1);

        collection.clear();
        System.out.println(collection);
        System.out.println(collection1);

    }

        public static void main4(String[] args) {
            Collection<String> collection = new ArrayList<>();
            collection.add("hello world!");
            collection.add("hhahah");

            Collection<Integer> collection1 = new ArrayList<>();
            collection1.add(1);
            collection1.add(23456);

            System.out.println(collection);
            System.out.println(collection1);

            System.out.println(collection.isEmpty());


        }

    public static void main5(String[] args) {
        Collection<String> collection = new ArrayList<>();
        collection.add("hello world!");
        collection.add("hhahah");

        Collection<Integer> collection1 = new ArrayList<>();
        collection1.add(1);
        collection1.add(23456);

        System.out.println(collection);
        System.out.println(collection1);

        collection.remove("hhahah");

        System.out.println(collection);
        System.out.println(collection1);
    }

    public static void main6(String[] args) {
        Collection<String> collection = new ArrayList<>();
        collection.add("hello world!");
        collection.add("hhahah");

        Collection<Integer> collection1 = new ArrayList<>();
        collection1.add(1);
        collection1.add(23456);

        System.out.println(collection);
        System.out.println(collection1);

        System.out.println(collection.size());

    }

    public static void main7(String[] args) {
        Collection<String> collection = new ArrayList<>();
        collection.add("hello world!");
        collection.add("hhahah");

        Collection<Integer> collection1 = new ArrayList<>();
        collection1.add(1);
        collection1.add(23456);

        System.out.println(collection);
        System.out.println(collection1);

       collection.toArray();

    }

    public static void main(String[] args) {
        Collection<String> collection = new ArrayList<>();
        collection.add("hello world!");
        collection.add("hhahah");

        Collection<Integer> collection1 = new ArrayList<>();
        collection1.add(1);
        collection1.add(23456);

        System.out.println(collection);
        System.out.println(collection1);

/*        String[] objects = (String[])collection.toArray();
        System.out.println(Arrays.toString(objects));*/

    }



}
